package com.qingke.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import com.opensymphony.xwork2.ActionSupport;

public class StreamAction extends ActionSupport {
	private InputStream inputStream;
	private String fileName;
	public InputStream getInputStream() {
		return inputStream;
	}
	public void setInputStream(InputStream inputStream) {
		this.inputStream = inputStream;
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	@Override
	public String execute() throws Exception {
		String file="../workspace/StrutsExample/src/main/webapp/Downloads/rousongbing.jpg";
		try{
			inputStream=new FileInputStream(new File(file));
			fileName="download.jpg";
		}catch(Exception e){
			return ERROR;
		}
		return SUCCESS;
	}
}
